package com.xiaoshuidi.cloud.module.contract.enums.contract;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * 合同收租类型的枚举类
 *
 * @author 合房源码
 */
@Getter
@AllArgsConstructor
public enum CompanyContractOrderShareTypeEnum {

    ALL(1, "企业承担所有费用"),
    RENT_DEPOSIT_ONLY_WITH_PERSONAL(2, "企业只承担租金押金(寝室长承担其它)"),
    RENT_DEPOSIT_ONLY_WITH_ROOM(3, "企业只承担租金押金(房屋钱包承担其它)");
    private Integer code;
    private String msg;

    public static String getMsgByCode(Integer code) {
        if (code == null) {
            return "";
        }
        Optional<String> first = Arrays.stream(CompanyContractOrderShareTypeEnum.values()).filter(s -> s.getCode().equals(code)).map(s -> s.getMsg()).findFirst();
        if (first.isPresent()) {
            return first.get();
        }
        return "";
    }
}
